package com.zk.zklockfororderno;

public class OrderService implements Runnable {

    private NoGen orderNoGen = new NoGen();

    private Lock lock = new LockABImpl();
    @Override
    public void run() {
        getNo();
    }


    public void getNo(){
        lock.getLock();
        String no = orderNoGen.getNo();
        System.out.println(">>"+no+"<<<<<<");
        lock.unLock();
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new Thread(new OrderService()).start();
        }
    }

}
